
function validarEmail(){
    var email = document.getElementById("email").value;
    var expRegEmail = /^([0-9a-zA-Z]+([_.-]?[0-9a-zA-Z]+)*@[0-9a-zA-Z]+[0-9,a-z,A-Z,.,-]*(.){1}[a-zA-Z]{2,4})+$/;
    
    if(email.search(expRegEmail) == -1){
        var elem = document.getElementById("email");
        elem.style.color = "red";
        return false;
    }else{
        var elem = document.getElementById("email");
        elem.style.color = "blue";
        return true;
    }
}